package com.ly.mpayment.persist.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;


/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="user"

)

public class User  implements java.io.Serializable {


    // Fields

     private String useruuid;
     private String username;
     private String phonenum;
     private String password;
     private Integer userstatus;
     private Integer usertype;//用户类型 1 管理员 2超级管理员 3 下游渠道商  4上游渠道商
     private String token;
     private Date lastlogintime;
     private Date createtime;
     private String wechatid;
     private String remark;
     private Date expire;
//     private Integer isOpen;
     private Set<ErrorCode> errorCodesForUseruuid = new HashSet<ErrorCode>(0);


    // Constructors

    /** default constructor */
    public User() {
    }


    public User(String useruuid) {
		this.useruuid = useruuid;
	}


	/** full constructor */
    public User(String username, String phonenum, String password, Integer userstatus, Integer usertype, String token, Date lastlogintime, Date createtime, String wechatid, String remark, Set<UpShopProduct> upShopPros, Set<DownOrderLog> downOrderLogs, Set<UpProductLog> upProductLogs, Set<UpOrderRefund> upOrderRefunds, Set<UpOrderLog> upOrderLogs, Set<DownOrderRefund> downOrderRefunds, Set<DownRechargeGame> downRechargeGames, Set<DownShopRecharge> downShops, Set<UserLoginLog> userLoginLogs, Set<UpRechargeRecord> upRechargeRecords, Set<DownRechargeFlow> downRechargeFlows, Set<DownProductLog> downProLogs, Set<UpgameRecharge> upgameRecharges,  Set<PlatFormAccountRecord> platFormAccountRecords, Set<MatchingStrategy> matchingStrategies, Set<UpOrder> upOrders, Set<ErrorCode> errorCodesForUseruuid, Set<DownShopProduct> downShopProducts, Set<ErrorCode> errorCodesForUseUseruuid, Set<DownShopInfo> downShopInfos) {
        this.username = username;
        this.phonenum = phonenum;
        this.password = password;
        this.userstatus = userstatus;
        this.usertype = usertype;
        this.token = token;
        this.lastlogintime = lastlogintime;
        this.createtime = createtime;
        this.wechatid = wechatid;
        this.remark = remark;
//        this.upShopPros = upShopPros;
//        this.downOrderLogs = downOrderLogs;
//        this.upProductLogs = upProductLogs;
//        this.upOrderRefunds = upOrderRefunds;
//        this.upOrderLogs = upOrderLogs;
//        this.downOrderRefunds = downOrderRefunds;
//        this.downRechargeGames = downRechargeGames;
//        this.downShops = downShops;
//        this.userLoginLogs = userLoginLogs;
//        this.upRechargeRecords = upRechargeRecords;
//        this.downRechargeFlows = downRechargeFlows;
//        this.downProLogs = downProLogs;
//        this.upgameRecharges = upgameRecharges;
//        this.upShopInfos = upShopInfos;
//        this.platFormAccountRecords = platFormAccountRecords;
//        this.matchingStrategies = matchingStrategies;
//        this.upOrders = upOrders;
//        this.errorCodesForUseruuid = errorCodesForUseruuid;
//        this.downShopProducts = downShopProducts;
//        this.errorCodesForUseUseruuid = errorCodesForUseUseruuid;
//        this.downShopInfos = downShopInfos;
    }


    // Property accessors
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Column(name="useruuid", unique=true, nullable=false, length=40)

    public String getUseruuid() {
        return this.useruuid;
    }

    public void setUseruuid(String useruuid) {
        this.useruuid = useruuid;
    }

    @Column(name="username", length=40)

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Column(name="phonenum", length=40)

    public String getPhonenum() {
        return this.phonenum;
    }

    public void setPhonenum(String phonenum) {
        this.phonenum = phonenum;
    }

    @Column(name="password", length=40)

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(name="userstatus")

    public Integer getUserstatus() {
        return this.userstatus;
    }

    public void setUserstatus(Integer userstatus) {
        this.userstatus = userstatus;
    }

    @Column(name="usertype")

    public Integer getUsertype() {
        return this.usertype;
    }

    public void setUsertype(Integer usertype) {
        this.usertype = usertype;
    }

    @Column(name="token", length=40)

    public String getToken() {
        return this.token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @Column(name="lastlogintime", length=19)

    public Date getLastlogintime() {
        return this.lastlogintime;
    }

    public void setLastlogintime(Date lastlogintime) {
        this.lastlogintime = lastlogintime;
    }

    @Column(name="createtime", length=19)

    public Date getCreatetime() {
        return this.createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    @Column(name="wechatid", length=40)

    public String getWechatid() {
        return this.wechatid;
    }

    public void setWechatid(String wechatid) {
        this.wechatid = wechatid;
    }

    @Column(name="remark", length=1000)

    public String getRemark() {
        return this.remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Column(name="expire")
	public Date getExpire() {
		return expire;
	}


	public void setExpire(Date expire) {
		this.expire = expire;
	}

//	@Column(name="is_open")
//	public Integer getIsOpen() {
//		return isOpen;
//	}
//
//	public void setIsOpen(Integer isOpen) {
//		this.isOpen = isOpen;
//	}


	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="userByUseruuid")

    public Set<ErrorCode> getErrorCodesForUseruuid() {
        return this.errorCodesForUseruuid;
    }

    public void setErrorCodesForUseruuid(Set<ErrorCode> errorCodesForUseruuid) {
        this.errorCodesForUseruuid = errorCodesForUseruuid;
    }




}
